package com.yuan.spring.mvc;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


/**
 * 异常处理类
 * Created by yeg on 2017/9/8.
 */
@RestControllerAdvice
public class ErrorController {


    @ExceptionHandler(Exception.class)
    //加上status post请求会有异常提示
    //@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public ResponseMsg errorResponse(Exception ex) {
        return new ResponseMsg("0", "", ex.getMessage());
    }

}
